#[cfg(feature = "sys")]
mod sys;
#[cfg(feature = "sys")]
pub use sys::*;

#[cfg(not(feature = "sys"))]
mod empty;
#[cfg(not(feature = "sys"))]
pub use empty::*;

mod family;
pub use family::*;
mod generic;
pub use generic::*;

pub trait XFontType: Default {
	fn system() -> String;
	fn fallback(&self, text: &str, name: &str, weight: Weight, stretch: Stretch, style: Style) -> Fallback;
}

#[derive(Debug, Default)]
pub struct Fallback {
	pub index: Option<u32>,
	pub unique: Option<String>,
	// TODO Variation attr
	pub file: std::path::PathBuf,
}

impl Family {
	pub fn serif() -> Self {
		Generic::Serif.system().into()
	}
	pub fn sans_serif() -> Self {
		Generic::SansSerif.system().into()
	}
	pub fn monospace() -> Self {
		Generic::Monospace.system().into()
	}
	pub fn cursive() -> Self {
		Generic::Cursive.system().into()
	}
	pub fn fantasy() -> Self {
		Generic::Fantasy.system().into()
	}
	pub fn system_ui() -> Self {
		Generic::SystemUi.system().into()
	}
	pub fn ui_serif() -> Self {
		Generic::UiSerif.system().into()
	}
	pub fn ui_sans_serif() -> Self {
		Generic::UiSansSerif.system().into()
	}
	pub fn ui_monospace() -> Self {
		Generic::UiMonospace.system().into()
	}
	pub fn ui_rounded() -> Self {
		Generic::UiRounded.system().into()
	}
	pub fn emoji() -> Self {
		Generic::Emoji.system().into()
	}
	pub fn math() -> Self {
		Generic::Math.system().into()
	}
	pub fn fang_song() -> Self {
		Generic::FangSong.system().into()
	}
}
